/*weSenOolfcPLiqI9p2fAV4pKQsBuN9hl2RI6P5PwWvhH/sKkGIiAgwTQZJb2cbcc*/
/*
 * @Author: xiahui 
 * @PageInfo: 生效 
 * @Date: 2019-01-18 14:44:00 
 * @Last Modified by: xiahui
 * @Last Modified time: 2019-07-10 15:54:01
 */
import { AREA, URL, FIELDS } from '../../constance';
import { listBaseScriptAction, showListScriptActionDlg, isShowScriptActionDlg } from '../../utils/baseScriptUtil';
import { showWarningDialog } from '../../../../../scmpub/scmpub/pub/tool/messageUtil';
import { getLangByResId } from '../../../../../scmpub/scmpub/pub/tool/multiLangUtil';

export default function(props, record, index) {
	showWarningDialog(getLangByResId(this, '4004PURDAILY-000042'), getLangByResId(this, '4004PURDAILY-000043'), {
		/* 国际化处理： 确认生效,是否确定将此合同生效*/
		beSureBtnClick: () => {
			let billDate;
			if (record && index >= 0) {
				if (record[FIELDS.valdate]) {
					billDate = record[FIELDS.valdate].value;
				}
			} else {
				let valdate = props.table.getCheckedRows(AREA.listTableId)[0].data.values[FIELDS.valdate];
				if (valdate) {
					billDate = props.table.getCheckedRows(AREA.listTableId)[0].data.values[FIELDS.valdate].value;
				}
			}

			if (billDate && isShowScriptActionDlg(billDate)) {
				showListScriptActionDlg.call(
					this,
					props,
					URL.validate,
					getLangByResId(this, '4004PURDAILY-000044'),
					record,
					index,
					getLangByResId(this, '4004PURDAILY-000045')
				); /* 国际化处理： 生效成功,实际生效日期与计划生效日期不符，请输入原因*/
			} else {
				listBaseScriptAction.call(
					this,
					props,
					URL.validate,
					getLangByResId(this, '4004PURDAILY-000044'),
					record,
					index
				); /* 国际化处理： 生效成功*/
			}
		}
	});
}

/*weSenOolfcPLiqI9p2fAV4pKQsBuN9hl2RI6P5PwWvhH/sKkGIiAgwTQZJb2cbcc*/